package com.zh.seckill.util;


import org.junit.jupiter.api.Test;
import org.springframework.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author zh
 * 手机号码校验
 */
public class ValidatorUtil {


    private static final Pattern mobile_pattern = Pattern.compile("^[1][3-9][0-9]{9}$");

    //如果满足规则，返回T, 否则返回F
    public static boolean isMobile(String mobile) {
        if(!StringUtils.hasText(mobile)) {
            return false;
        }

        Matcher matcher = mobile_pattern.matcher(mobile);
        return matcher.matches();
    }

    @Test
    public void t1() {
        String mobile = "11300000009";
        System.out.println(isMobile(mobile));//
    }
}
